<template>
	<view class="box">
		<view class="list">
			<view class="demo flex" v-for="(item,index) of list" :key="index" @click="chooseHander(item)">
				<view class="img f-w">
					<image :src="item.Avatar" mode=""></image>
				</view>
				<view class="right">
					<view class="one fw-bt f28">
						<view>{{item.real_name}}</view>
						<view>{{item.phone}}</view>
					</view>
					<view class="two f24 c999">{{addr}}</view>
				</view>
			</view>
			<view class="none c999 f24 tr">
				没有更多了哟~
			</view>
		</view>
	</view>
</template>

<script>
	import Cache from '@/util/cache.js'
	export default {
		data() {
			return {
				id: '', //店铺id
				list: [],
				addr: '',
				mar: {}
			}
		},
		onReachBottom() {
			console.log('加载更多');
		},
		onLoad(options) {
			if (options.id) {
				this.id = options.id
			}
			this.mar = JSON.parse(Cache.get('market'))
			this.getbuyer()
			this.addr = this.mar.mar_name
		},
		methods: {
			// 获取买家列表
			getbuyer() {
				let data = {
					mar_id: this.mar.id
				}
				this.$request('buyer/lst', data, 'GET').then(res => {
					if (res.status == 200) {
						this.list = res.data

					}
				})

			},

			// 确定买手
			chooseHander(item) {
				let pages = getCurrentPages();
				let page = pages[pages.length - 2];
				page.$vm.buy_user = item;
				uni.navigateBack();
				// uni.navigateBack();
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {

		.list {
			margin: 0 auto;
			width: 690rpx;

			.demo {
				padding: 40rpx 0;
				border-bottom: 1rpx solid #eee;

				.img {
					flex-shrink: 0;
					width: 86rpx;
					height: 86rpx;

					image {
						width: 100%;
						height: 100%;
						border-radius: 50%;
					}
				}

				.right {
					flex: 1;
					margin-left: 24rpx;

					.two {
						margin-top: 20rpx;
					}
				}
			}

			.none {
				padding: 40rpx 0;
			}
		}
	}
</style>
